/*
 * Copyright (c) 2002 Boris Pruessmann and others. All rights reserved. This
 * program and the accompanying materials are made available under the terms of
 * the Common Public License v0.5 which accompanies this distribution, and is
 * available at http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors: Boris Pruessmann - Initial implementation.
 */
package net.sourceforge.perforce.core;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;

/**
 * @version $Revision: 488 $
 * @author <a href="mailto:bpruessmann@users.sourceforge.net">Boris
 *         Pruessmann</a>
 */
public interface IP4TeamProvider {
  // -------------------------------------------------------------------------
  // Predicate Functions

  /**
   * Checks whether the given resource has a corresponding remote resource.
   * 
   * @param resource the resource.
   * @return true if there is a corresponding remote resource.
   */
  boolean hasRemote(IResource resource);

  /**
   * Checks whether the given resource is currently opened for edit.
   * 
   * @param resource the resource.
   * @return true if resource is currently opened for edit.
   */
  boolean isCheckedOut(IResource resource);

  //----------------------------------------------------------------------------
  // --------- Methods

  /**
   * Performs a 'p4 add' operation with the given resources.
   * 
   * @param resources the resources to add.
   * @param depth the depth of the operation.
   * @param monitor the monitor for progress feedback.
   * @return the status of the operation(s).
   * 
   * @throws PerforceException in case of an unexpected error.
   */
  IStatus openForAdd(IResource[] resources, int depth, IProgressMonitor monitor)
      throws PerforceException;

  /**
   * Performs a 'p4 delete' operation with the given resources.
   * 
   * @param resources the resources to delete.
   * @param depth the depth of the operation.
   * @param monitor the monitor for progress feedback.
   * @return the status of the operation(s).
   * 
   * @throws PerforceException in case of an unexpected error.
   */
  IStatus openForDelete(IResource[] resources, int depth, IProgressMonitor monitor)
      throws PerforceException;

  /**
   * Performs a 'p4 edit' operation with the given resources.
   * 
   * @param resources the resources to edit.
   * @param depth the depth of the operation.
   * @param monitor the monitor for progress feedback.
   * @return the status of the operation(s).
   * 
   * @throws PerforceException in case of an unexpected error.
   */
  IStatus openForEdit(IResource[] resources, int depth, IProgressMonitor monitor)
      throws PerforceException;

  /**
   * Performs a 'p4 revert' operation with the given resources.
   * 
   * @param resources the resources to revert.
   * @param depth the depth of the operation.
   * @param monitor the monitor for progress feedback.
   * @return the status of the operation(s).
   * 
   * @throws PerforceException in case of an unexpected error.
   */
  IStatus revert(IResource[] resources, int depth, IProgressMonitor monitor)
      throws PerforceException;

  /**
   * Called to mark the given resources as resolved.
   * 
   * @param resources the sources that should be marked as resolved.
   * @param monitor the progress monitor.
   * @return the status of the operation(s).
   * 
   * @throws PerforceException in case of an unexpected error.
   */
  IStatus markAsResolved(IResource[] resources, IProgressMonitor monitor) throws PerforceException;
}
